package schema

import "gorm.io/plugin/soft_delete"

type UserLoginLogs struct {
	Id            int64                  `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT;comment:主键 - 自增" json:"id"`
	UserId        int64                  `gorm:"column:user_id;type:bigint(20);default:0;comment:用户ID;NOT NULL" json:"user_id"`
	Source        string                 `gorm:"column:source;type:varchar(50);comment:登录平台;NOT NULL" json:"source"`
	LoginAt       int64                  `gorm:"column:login_at;type:bigint(20);comment:登录时间;NOT NULL" json:"login_at"`
	Device        string                 `gorm:"column:device;type:varchar(100);comment:登录设备;NOT NULL" json:"device"`
	Ip            string                 `gorm:"column:ip;type:varchar(20);comment:IP地址" json:"ip"`
	CountryString string                 `gorm:"column:country_string;type:varchar(50);comment:国家" json:"country_string"`
	CountryZh     string                 `gorm:"column:country_zh;type:varchar(20);comment:国家代码" json:"country_zh"`
	City          string                 `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
	CityZh        string                 `gorm:"column:city_zh;type:varchar(50);comment:城市代码" json:"city_zh"`
	DeviceName    string                 `gorm:"column:device_name;type:varchar(50);comment:设备名称" json:"device_name"`
	ChannelId     int32                  `gorm:"column:channel_id;type:tinyint(4);comment:渠道id" json:"channel_id"`
	ChannelName   string                 `gorm:"column:channel_name;type:varchar(50);comment:渠道名称" json:"channel_name"`
	AdId          string                 `gorm:"column:ad_id;type:varchar(50);comment:广告id" json:"ad_id"`
	AdName        string                 `gorm:"column:ad_name;type:varchar(50);comment:广告名称" json:"ad_name"`
	DomainName    string                 `gorm:"column:domain_name;type:varchar(100);comment:请求域名" json:"domain_name"`
	UserAgent     string                 `gorm:"column:user_agent;type:varchar(500);comment:端浏览器信息" json:"user_agent"`
	CreatedAt     int64                  `gorm:"column:created_at;type:bigint(20);comment:创建时间;NOT NULL" json:"created_at"`
	UpdatedAt     int64                  `gorm:"column:updated_at;type:bigint(20);comment:更新时间" json:"updated_at"`
	DeletedAt     *soft_delete.DeletedAt `gorm:"softDelete:deleted_at;column:deleted_at;type:bigint(20);NULL;default:null" json:"deletedAt"`
}

func (u UserLoginLogs) TableName() string {
	return "user_login_logs_1"
}
